package com.shujia.dwd

import com.shujia.util.FlinkTool

object DwdPaidOrderDetail extends FlinkTool{
  /**
    * 需要在子类实现抽象方法
    *
    */
  override def run(args: Array[String]): Unit = {

    table.executeSql(
      """
        |
        |insert into gma_dwd.dwd_paid_order_detail
        |select
        |b.id as detail_id,
        |b.order_id,
        |a.user_id,
        |a.province_id,
        |b.sku_id,
        |cast(b.sku_num as INT) as sku_num,
        |b.order_price,
        |b.create_time,
        |a.payment_way,
        |a.operate_time as pay_time
        |from
        |(select * from gma_ods.ods_mysql_kafka_order_info /*+ OPTIONS('scan.startup.mode'='earliest-offset') */ where order_status='2' -- 已支付
        |)
        |as a
        |join
        |gma_ods.ods_mysql_kafka_order_detail /*+ OPTIONS('scan.startup.mode'='earliest-offset') */  as b
        |on a.id=b.order_id
        |
        |
        |
      """.stripMargin)

  }
}
